<template>
    <van-nav-bar title="主页" left-text="返回" fixed left-arrow @click-left="onClickLeft" />
    <div style="height: 50px;"></div>
    <van-search v-model="value" shape="round" background="#4fc08d" placeholder="请输入搜索关键词" @click="search" />
    <swiper></swiper>
    <!-- 宫格 -->
    <van-grid :column-num="4">
        <van-grid-item v-for="item in navDate" :key="value" :icon="item.image_src" :text="item.name" />
    </van-grid>
    <!-- 楼层 -->
    <div v-for="item in floorDate">
        <img style="width: 100%;" :src="item.floor_title.image_src" alt="">
        <div v-for="items in item.children">
            <img style="height: 80px;width: 80px;" :src="items.product_list.image_src" alt="">
        </div>
    </div>
</template>

<script setup>
import swiper from '@/components/swiper.vue'
import { ref } from 'vue'

import { navApi } from '@/api/api'
let navDate = ref([])
navApi().then(res => {
    console.log('宫格数据', res)
    navDate.value = res.data.message
})

import { floorApi } from '@/api/api'
let floorDate = ref([])
floorApi().then(res=>{
    console.log('楼层数据',res)
    floorDate.value=res.data.message
})
import {useRouter} from 'vue-router'
let router=new useRouter()
const search=()=>{
    router.push('/search')
}
</script>

<style lang="scss" scoped></style>